# -*- coding:utf-8 -*-
data = {'A':'礼物A','B':'礼物B','C':'礼物C','D':'礼物D','E':'礼物E','F':'礼物F'}
new_gift = {}
person = list(data.keys())
for p in person:
    flag = 0  # 标记自己的礼物是否分出去
    if p in data:
        flag = 1  # 如果自己的礼物还没分出去
        my_gift = data.pop(p)  # 将自己的礼物从data中移除
    get_gift = data.popitem()  # 并从data中随机移除一个礼物
    new_gift[p] = get_gift[1]  # 将移除的礼物作为得到的礼物
    if flag:
        data[p] = my_gift  # 将自己的礼物添加到未分配的data中
print(new_gift)

